module.exports = {
  dbName: 'template',
  dbPath: '_downloads/template.db',
  // 判断数据库是否打开
  isOpen() {
    return plus.sqlite.isOpenDatabase({
      name: this.dbName,
      path: this.dbPath,
    })
  },
  // 打开弹窗
  openSqlite() {
    return new Promise((resolve, reject) => {
      plus.sqlite.openDatabase({
        name: this.dbName,
        path: this.dbPath,
        success(e) {
          resolve(e)
        },
        fail(e) {
          reject(e)
        },
      })
    })
  },
  // 关闭弹窗
  closeSqlite() {
    return new Promise((resolve, reject) => {
      plus.sqlite.closeDatabase({
        name: this.dbName,
        success(e) {
          resolve(e)
        },
        fail(e) {
          reject(e)
        },
      })
    })
  },
}
